<?php
header ("Content-Type:text/html; charset= utf-8");
require_once ('config.php');
require_once (WEBURL.'/include/conn.php');
require_once ('login_status_check.php');
if(!isset($_POST['admin_name'])){
	exit();
}
if(!checkLogin()){
		$gotopage=base64_encode("admin_modify_byself.php");
	    header("Location:admin_login.php?gotopage=".$gotopage);
}
else{
	$admin_id=$_POST['id'];
	$pwd=$_POST['pwd'];
	$admin_true_name=$_POST['admin_true_name'];
	$email=$_POST['email'];
	if($pwd!=""){
		$sql_modify_admin="update admin set admin_pwd='$pwd',admin_true_name='$admin_true_name',email='$email' 
		where admin_id=$admin_id;";
	}else{
		$sql_modify_admin="update admin set admin_true_name='$admin_true_name',email='$email' 
		where admin_id=$admin_id;";
	}
	$result_modify_admin=mysql_query($sql_modify_admin);
	if($result_modify_admin){
		echo "<script language=JavaScript> alert('修改个人信息成功！'); window.location.href='admin_modify_byself.php';</script>";
	}else{
		echo "<script language=JavaScript> alert('修改个人信息失败！'); history.back();</script>";
		
	}
	
}